package com.wanxi.Dao;

import com.wanxi.pojo.Ledger;
import com.wanxi.pojo.User;
import com.wanxi.pojo.query.LedgerQuery;
import com.wanxi.pojo.query.UserQuery;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper //告诉springboot这是个mybatis的mapper类
@Repository //交给springboot容器管理，标注为数据层
public interface HFMDao {
    //根据id查询用户
    User queryUserId(int userid);

    //root查看所有账本
    List<Ledger> rootledger(LedgerQuery ledgerQuery);
    //非root查看账本
    List<Ledger> ledger(@Param("ledgerQuery") LedgerQuery ledgerQuery, @Param("userID") int userID);

    //获取收支类型，返还给加账界面
    List<String> getIEName();
    //获取用户有什么卡，返还给加账界面
    List<String> getCardBank(int userid);

    //查询IEId和CardId
    int IEId(@Param("IEName") String IEName, @Param("IorE") String IorE);
    int CardId(@Param("userID") int userID, @Param("CardBank") String CardBank);
    //添加账本
    boolean addLedger(@Param("Time")String Time,@Param("IEId")int IEId,@Param("CardId")int CardId,
                      @Param("Money")int Money,@Param("userID")int userID,@Param("beizhu")String beizhu);

    //展示所有用户
    List<User> userList();

    //根据名字搜索用户
    List<User> userListByName(UserQuery userQuery);
    //添加用户
    int addUser(User user);
    // 修改用户
    int upDateUser(User user);


    //删除用户
    int usertableDeleteUserById(@Param("userID")Integer userID);
    int ledgerDeleteUserById(@Param("userID")Integer userID);




}
